From ead966b0ab369f54bbcb1afcc88deacd7692ede1 Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Mon, 31 Aug 2015 21:25:25 -0400 Subject: [PATCH] Use find_root_manifest_for_cwd for now-duped code in verify-project --- src/bin/verify_project.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/bin/verify_project.rs b/src/bin/verify_project.rs index b1c1b4b61..b4998282e 100644 --- a/src/bin/verify_project.rs +++ b/src/bin/verify_project.rs @@ -1,9 +1,9 @@ use std::collections::HashMap; -use std::fs; use std::fs::File; use std::io::prelude::*; use std::process; +use cargo::util::important_paths::{find_root_manifest_for_cwd}; use cargo::util::{CliResult, Config}; use rustc_serialize::json; use toml; @@ -37,13 +37,10 @@ pub fn execute(args: Flags, config: &Config) -> CliResult> { let mut contents = String::new(); let filename = args.flag_manifest_path.unwrap_or("Cargo.toml".into()); - - if !filename.ends_with("Cargo.toml") { - fail("invalid", "the manifest-path must be a path to a Cargo.toml file") - } - if !fs::metadata(&filename).is_ok() { - fail("invalid", &format!("manifest path `{}` does not exist", filename)) - } + let filename = match find_root_manifest_for_cwd(Some(filename)) { + Ok(manifest_path) => manifest_path, + Err(e) => fail("invalid", &e.to_string()), + }; let file = File::open(&filename); match file.and_then(|mut f| f.read_to_string(&mut contents)) { -- 2.30.2